let form = document.forms[0];
console.debug(form);

form.onsubmit=function(event){
    event.stopPropagation();
    event.preventDefault();
    fetch("login.let",{
        method:"POST",
        body:new URLSearchParams(new FormData(form)),
        headers:{'Content-Type': 'application/x-www-form-urlencoded'},
        credentials: 'include'
    }).then(r=>r.json()).then((data)=>{
        if(data.ok){
            window.location="./admin/";
        }else{
            alert(data.message);
        }
    });
}